module.exports = [
  {
    name: 'Global ignores',
    ignores: [
      '**/dist/**',
      '**/node_modules/**',
      '**/unpackage/**',
      '**/*.min.js',
      '**/static/**'
    ]
  },
  
  {
    name: 'Basic JavaScript',
    files: ['**/*.js'],
    rules: {
      'no-unused-vars': 'warn',
      'no-undef': 'warn',
      'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
      'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
    },
    languageOptions: {
      globals: {
        // UniApp 全局变量
        uni: 'readonly',
        plus: 'readonly',
        getApp: 'readonly',
        getCurrentPages: 'readonly',
        // 小程序全局变量
        wx: 'readonly',
        qq: 'readonly',
        tt: 'readonly',
        swan: 'readonly',
        my: 'readonly',
        // 其他常见全局变量
        console: 'readonly',
        process: 'readonly'
      }
    }
  },
  
  {
    name: 'Vue files',
    files: ['**/*.vue'],
    plugins: {
      vue: require('eslint-plugin-vue')
    },
    languageOptions: {
      parser: require('vue-eslint-parser'),
      parserOptions: {
        ecmaVersion: 'latest',
        sourceType: 'module'
      },
      globals: {
        uni: 'readonly',
        plus: 'readonly',
        getApp: 'readonly',
        getCurrentPages: 'readonly',
        wx: 'readonly',
        qq: 'readonly',
        tt: 'readonly',
        swan: 'readonly',
        my: 'readonly',
        console: 'readonly',
        process: 'readonly'
      }
    },
    rules: {
      'vue/multi-word-component-names': 'off',
      'vue/require-default-prop': 'off',
      'vue/no-v-html': 'off',
      'no-unused-vars': 'warn',
      'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
      'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
    }
  }
];